package dbutilsDemo.dbpoolDemo.d1;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class TestTransaction {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		testTransaction();
	}

	private static void testTransaction() {
		// DBPoolFactory df = DBPoolFactory.getInstance();

		Connection con = null;
		Statement stmt = null;
		ResultSet rs = null;
		try {
			// df.add("jxc", "com.mysql.jdbc.Driver",
			// "jdbc:mysql://paipaiestore.com/samland", "samland", "*****");

			Transaction.beginTransaction("yndx_80");
			con = Transaction.getConnection();
			stmt = con.createStatement();
			rs = stmt.executeQuery("SELECT '1','2',sysdate FROM dual");
			while (rs.next()) {
				System.out.println(rs.getString(1));
				System.out.println(rs.getString(2));
				System.out.println(rs.getString(3));
			}
			Transaction.commitTransaction();
			// df = null;
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				Transaction.closeTransaction();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}
}
